from pyecharts import *
from random import *
import time
import sys
# sys.path.append('/root/dev/python/mytest')
from mytest.test import *
from mytest.test2 import Ping3


def random_point():
    return [random.randint(1, 10) for _ in range(6)]


def reflesh(func):
    def inner():
        while 1:
            func()
            time.sleep(5)
            print('sleep 5 sec.')
    return inner


# @reflesh
def line4():
    line = Line('a', 1)
    t = Ping3()
    t.ping()
    ips = t.select('day')
    # for i, ii in enumerate(mytest.statis_ips):
    #     if len(mytest.statis_ips[i]) > 6:
    #         line.add()
    #         line.add(mytest.statis_ips[i][0], [_ for _ in range(7)], [_[1] for _ in mytest.statis_ips[i][1:8

    # line.add(ips)                                                                       ]])
    timeline = Timeline(timeline_bottom=1, width=1000, height=700)
    timeline.add(line, 'A')
    timeline.render()

    # for i, ii in enumerate(line.get_options()):
    for key in line.get_options().keys():
        print(line.get_options()[key])


if __name__ == '__main__':
    # line4()
    t = Ping3()
    t.ping()
    ips = t.select()
    print(ips)